<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .high {
            height: 1000px;
        }
    </style>
</head>
<body>
    <div>
        <form>
            <input type="text" class="input1" name="aaa">
            <button type="reset">reset</button>
            <button type="submit">submit</button>
        </form>
        <hr>
        <div class="high"></div>
        <p>键盘事件：</p>
        <input type="text" class="keyborad">
    </div>
    <script>
        var input = document.querySelector('.input1');
        input.addEventListener('focus', function() {
            console.log('当世界聚焦于你');
        })
        input.addEventListener('blur', function() {
            console.log('完美谢幕');
        })
        // 是一个比较懒的input
        input.addEventListener('change', function() {
            console.log('狗子，你变了，你变得我不认识了！');
        })
        input.addEventListener('submit', function () {
            alert(666)
            console.log('提交表单，当上保安，等着小丹，盼着下班');
        })
        // 加强版的change
        input.addEventListener('input', function() {
            console.log('input');
        })

        //====== keyborad键盘事件 ========
        var key = document.querySelector('.keyborad');
        key.addEventListener('keydown', function() {
            console.log('按下葫芦起来瓢');
        })
        // 表示输入结束
        key.addEventListener('keyup', function() {
            console.log('up up');
        })
        key.addEventListener('keypress', function() {
            console.log('肩上的担子很重');
        })
        // =========== UI界面的事件 ============
        window.addEventListener('load', function() {
            console.log('热身完毕');
        })
        window.onresize = function() {
            console.log('准备变形');
        }
        window.onscroll = function() {
            console.log('圆润的离开');
        }
    </script>
</body>
</html>